var conexionfive;
function loadFileAcceptFriend(url) 
{
  if(url=='')
  {
        return;
  }
  
  conexionfive=postRequest();
  conexionfive.onreadystatechange = procesarEventos;
  //conexion1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  conexionfive.open("GET", url, true);
  conexionfive.send(null);
}

function postRequest() 
{
  var xmlHttp=null;
  if (window.XMLHttpRequest) {
	  xmlHttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
	      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return xmlHttp;
}

function procesarEventos()
{
	
  if(conexionfive.readyState == 4)
  {
	  accepted(conexionfive.responseText);
  } 
}   
        function accepted(str){
            if(str=="yes"){
        	alert('Datos actualizados ');
        	user_data();
        	}else{
				alert('Se ha presentado algun problema. Intentar mas tarde');
            }
        }
       
        function updateUser(){
        	resp=confirm("Actualizar Datos?") 
    		if(resp) 
    		{  
    			    var id_u =document.getElementById("id_u").value;
    		        var name = document.getElementById('name').value;
    		        var last_name = document.getElementById('last_name').value;
    		        var email = document.getElementById('email').value;
    		        var mobil = document.getElementById('mobil').value;
    		        var url = "update_user.php?id_u="+id_u+"&name="+name+"&last_name="+last_name+"&email="+email+"&mobil="+mobil ;
    		        loadFileAcceptFriend(url);
    		}
    		else
    			return false;	       
        }